package com.framework.bdf4j.socket.nclient;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
* 客户端处理器
**/

public class NettyClientHandler extends ChannelInboundHandlerAdapter {
 
  private String responseResult;
 
  @Override
  public void channelActive(ChannelHandlerContext ctx) throws Exception {
    System.out.println("客户端Active .....");
  }
 
  @Override
  public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
//    log.info("客户端收到消息: {}", msg.toString());
    this.responseResult = msg.toString();
    ctx.close();
  }
 
  @Override
  public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
    cause.printStackTrace();
    ctx.close();
  }

public String getResponseResult() {
	return responseResult;
}

public void setResponseResult(String responseResult) {
	this.responseResult = responseResult;
}
  
  
  
}
